const webpack = require('webpack')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
module.exports = {
    devServer: {
        proxy: {
            '/api': {
                target: 'http://localhost:8888/',
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    '^/api': ''
                },

            }
        },
    },
    publicPath: '/oilsection',
    lintOnSave: false,
    assetsDir: "static",
    productionSourceMap:false,
    configureWebpack: {
        externals:{
            "BMap":"BMap",
            "BMapGL":"BMapGL"
        },
        plugins: [
            new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
            // 下面是下载的插件的配置
            new CompressionWebpackPlugin({
                algorithm: 'gzip',
                test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
                threshold: 10240,
                minRatio: 0.8
            }),
            new webpack.optimize.LimitChunkCountPlugin({
                maxChunks: 5,
                minChunkSize: 100
            })
        ]
    }
}